﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RadiationUI.Forms
{
	public partial class Admin: Form
	{
        private MdiClientController m_mdicontroller;

		public Admin()
		{
            InitializeComponent();
            m_mdicontroller = new MdiClientController(this);
            m_mdicontroller.BorderStyle = BorderStyle.None;
		}

        void Connection_ServerVersionReceived(object sender, Radiation.Common.GenericEventArgs e)
        {
            MethodInvoker action = delegate
            {
                this.sserverVersionStatusLabel2.Text = (string)e["message"];
            };
            this.BeginInvoke(action);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Admin_Load(object sender, EventArgs e)
        {
            Connection.ServerVersionReceived += new EventHandler<Radiation.Common.GenericEventArgs>(Connection_ServerVersionReceived);
            Connection.sendToAPI(Radiation.Common.Communication.APIMethods.GET_SERVER_VERSION);
        }

        private void panel5_Paint(object sender, PaintEventArgs e)
        {

        }

        private void fermerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Admin_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
                this.Close();
        }

        private void Admin_FormClosing(object sender, FormClosingEventArgs e)
        {
            Connection.ServerVersionReceived -= new EventHandler<Radiation.Common.GenericEventArgs>(Connection_ServerVersionReceived);
        }
	}
}
